// 回关
function judgeattention() {
  let btn = document.getElementsByClassName("followBtn");
  for (let i = 0; i < btn.length; i++) {
    let uid = btn[i].getAttribute("uid");
    $.ajax({
      url: "/weibo/user/judgeUserOfConnection",
      type: "post",
      data: {
        id: uid,
      },
      success: function (result) {
        if (result) {
          btn.innerHTML = `<i class="iconfont">&#xe664;</i>已关注`;
          btn.classList.add("al-attention");
        }
      },
    });
  }
}
function backAttention(btn) {
  let uid = btn.getAttribute("uid");
  if (btn.classList.contains("al-attention")) {
    customConfirm("确定取消关注该用户？", function (result) {
      if (result) {
        btn.classList.remove("al-attention");
        let icon = btn.querySelector(".iconfont");
        $.ajax({
          url: "/weibo/user/notConcernOtherUser",
          type: "post",
          data: {
            id: uid,
          },
          success: function () {
            btn.innerHTML = `<i class="iconfont">&#xe7df;</i>关注`;
          },
        });
      }
    });
  } else {
    $.ajax({
      url: "/weibo/user/concernOtherUser",
      type: "post",
      data: {
        id: uid,
      },
      success: function () {
        btn.classList.add("al-attention");
        btn.innerHTML = `<i class="iconfont">&#xe664;</i>已关注`;
      },
    });
  }
}

judgeattention();
